<template>
  <div>
    <el-form ref="form" :model="imageForm" label-width="80px">
      <el-row>
        <el-col :span="12">
          <el-form-item label="创建人:" prop="createUser">
            <el-input
              v-model="imageForm.createUser"
              placeholder=""
              disabled
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="直播id:" prop="id">
            <el-input
              v-model="imageForm.liveId"
              placeholder=""
              disabled
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="创建时间:" prop="createTime">
            <el-input
              v-model="imageForm.createTime"
              placeholder=""
              disabled
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="状态:" prop="status">
            <el-input
              v-model="imageForm.status"
              placeholder=""
              disabled
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <!-- 按钮 -->
      <el-form-item>
        <el-row type="flex" justify="center">
          <el-col :span="16">
            <el-button size="mini" type="primary" @click="btnOk"
              >返回上一页</el-button
            >
          </el-col>
        </el-row>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { getImgDetailApi } from "@/api/uploadImage";
export default {
  data() {
    return {
      // 数据对象
      imageForm: {
        liveId: "",
        createUser: "",
        createTime: "",
        status: "",
      },
    };
  },
  computed: {
    // formattedDates() {
    //   // 格式化日期
    //   return this.imageForm.map((item) => ({
    //     ...item,
    //     createTime: this.formatSeconds(item.createTime),
    //   }));
    // },
  },
  created() {
    if (this.$route.params.id) {
      this.imageDetail();
    }
  },
  methods: {
    // 封装一个转化时间的函数
    // formatSeconds(seconds) {
    //   // 将秒数转化为日期格式
    //   const date = new Date(seconds);
    //   return date.toLocaleString();
    // },
    // 详情数据
    async imageDetail() {
      const res = await getImgDetailApi(this.$route.params.id);
      console.log(res);
      this.imageForm = res.data;
    },
    btnOk() {
      this.$router.push("/imageUpload");
    },
  },
};
</script>

<style scoped></style>
